import type { ClassForm } from "@/types/class";
import request from "./request";
import type { DataList, pageForm, RESPONSE } from "@/types/base";

enum API {
  ADD_CLASS = "/manage/class/add",
  GET_CLASS_By_Page = "/manage/class/list",
  SEARCH_CLASS = "/manage/class/list",
  DEL_CLASS = "/manage/class/delete",
  UPDATE_CLASS = "/manage/class/update",
  GET_ALL_CLASS = "/manage/class/all",
}

export const reqAddClass = (data: ClassForm) =>
  request.post<null, RESPONSE<ClassForm>>(API.ADD_CLASS, data);
export const reqGetClassByPage = (data: pageForm) =>
  request.post<null, RESPONSE<DataList<ClassForm[]>>>(
    API.GET_CLASS_By_Page,
    data
  );
export const reqDelClass = (classId: string) =>
  request.post<null, RESPONSE<null>>(API.DEL_CLASS, { classId });
export const reqUpdateClass = (data: ClassForm) =>
  request.post<null, RESPONSE<null>>(API.UPDATE_CLASS, data);




export const reqGetAllClass = () =>
  request.get<null, RESPONSE<ClassForm[]>>(API.GET_ALL_CLASS);